package cn.bbs.ba.file;

import java.util.ArrayList;
import java.util.List;

public class FdfData {

	private FileUtils fileUtils = null;
	private List<FDFDTO> dataFList = new ArrayList<FDFDTO>();
	private List<String> titleList = new ArrayList<String>();
	private List<String> prppertyList = new ArrayList<String>();

	public FdfData(String strFilePath) {
		this.fileUtils = new FileUtils(strFilePath);
		this.read();
	}

	public List<FDFDTO> getFdfList() {
		return dataFList;
	}

	public List<String> getHeaderList() {
		return titleList;
	}

	public List<String> getPropertyList() {
		return prppertyList;
	}

	private void read() {
		this.fileUtils.open();
		FDFDTO fdfDto = null;
		while (true) {
			String strL = this.fileUtils.read();
			if (strL == null) {
				break;
			}
			fdfDto = new FDFDTO();
			String str[] = strL.split(",");
			fdfDto.setTitle(str[0]);
			fdfDto.setLength(str[1]);
			fdfDto.setDto(str[2]);
			fdfDto.setProperty(str[3]);
			titleList.add(str[0]);
			prppertyList.add(str[3]);
			dataFList.add(fdfDto);
		}
	}
}
